package com.driver.model;

import java.util.*;
import java.sql.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import com.carstop.model.*;
import com.passenger.model.*;
import com.member.model.*;
import com.driver.model.*;

public class DriverPathInfoDAO {


	public static List<DriverPathInfoVO> getAll() {
		List<DriverPathInfoVO> list = new ArrayList<DriverPathInfoVO>();
		DriverPathInfoVO carDriverVO = null;
		List<CarStopDetailVO> stopDetailList = null;
		CarDriverPathService drvPathSvc = new CarDriverPathService();
		CarStopDetailService stopDetailSvc = new CarStopDetailService();
		List<CarDriverPathVO> drvPathList = null;
		String drvPathId = null, stopId = null;
		CarDriverPathVO drvPathVO = null;
		CarStopDetailVO stopDetailVO = null;
		CarStopVO carstop = null;
		
		drvPathList = drvPathSvc.getAll();
		for (int i = 0; i < drvPathList.size(); i++) {
			drvPathVO = drvPathList.get(i);
			drvPathId = drvPathVO.getDriver_path_id();
			stopDetailList = stopDetailSvc.findByForgeinnOneKeyDetail(drvPathId);
			
			for (int j = 0; j < stopDetailList.size(); j++) {
				stopDetailVO  = stopDetailList.get(j);
				DriverPathInfoVO info = new DriverPathInfoVO();
				info.setDriverPathId(drvPathId);
				info.setArrivalTime(stopDetailVO.getArrival());
				
				stopDetailVO = stopDetailList.get(j);
				stopId = stopDetailVO.getStop_id();
				carstop = CarStopService.carstopMap.get(stopId);
				info.setStopId(carstop.getStop_id());
				list.add(info);
			}
		}
		
		return list;
	}
}